package com.haust.rabbit.sender;

import com.haust.rabbit.message.HaustMessage;
import org.springframework.amqp.core.AmqpTemplate;

public class MessageSender {
    private AmqpTemplate amqpTemplate;

    /**
     * 发送消息的方法
     * @return
     */
    public void sendMessage(String exchange, String routingKey, HaustMessage HaustMessage){
        amqpTemplate.convertAndSend(exchange,routingKey,HaustMessage);
    }

    public AmqpTemplate getAmqpTemplate() {
        return amqpTemplate;
    }

    public void setAmqpTemplate(AmqpTemplate amqpTemplate) {
        this.amqpTemplate = amqpTemplate;
    }
}
